import {createRouter, createWebHashHistory} from 'vue-router'

const routes = [
  // {
  //   path: "/",
  //   redirect: "/app"
  // },
  {
    path: '/register',
    component: () => import("@/views/registerAndLogin/register/Register")
  },
  {
    path: '/login',
    component: () => import("@/views/registerAndLogin/login/Login")
  },
  {
    path: '/user_agreement',
    component: () => import("@/views/agreement/User_agreement")
  },
  {
    path: '/privacy_policy',
    component: () => import("@/views/agreement/Privacy_policy")
  },
  {
    path: '/app',
    component: () => import("@/views/appContent/Main"),
    children: [
      // {
      //   path: "",
      //   redirect: "/app/index"
      // },
      {
        path: "index",
        component: ()=> import("@/views/appContent/index/Index")
      },
      {
        path: "question_answer/:question_id",
        component: ()=> import("@/views/appContent/questionAnswer/QuestionAnswer")
      },
      {
        path: "user_info/:user_id",
        component: ()=> import("@/views/appContent/userInfo/UserInfo"),
        children: [
          {
            path: "Answer",
            component: ()=> import("@/views/appContent/userInfo/UserAnswer")
          },
          {
            path: "Collect",
            component: ()=> import("@/views/appContent/userInfo/UserCollect")
          },
          {
            path: "Question",
            component: ()=> import("@/views/appContent/userInfo/UserQuestion")
          },
          {
            path: "Follow",
            component: ()=> import("@/views/appContent/userInfo/UserFollow")
          },
        ]
      },
      {
        path: "edit/:user_id",
        component: ()=> import("@/views/appContent/userInfo/Edit")
      },
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

export default router
